package com.mycompony.shopping.shangguan.sys.context;

import org.apache.struts2.dispatcher.SessionMap;

import com.mycompony.shopping.shangguan.sys.model.User;
import com.mycompony.shopping.shangguan.sys.util.Constant;
import com.opensymphony.xwork2.ActionContext;

public class SessionUtil {

	public static void putCurrentUser(User user) {
		SessionMap session = (SessionMap) ActionContext.getContext().get(ActionContext.SESSION);
		session.put(Constant.USER_SESSION_KEY, user);
	}
	
	public static User getCurrentUser() {
		SessionMap session = (SessionMap) ActionContext.getContext().get(ActionContext.SESSION);
		User user = (User) session.get(Constant.USER_SESSION_KEY);
		return user;
	}

}
